import {
	defineStore
} from 'pinia';

export const useUserInfoStore = defineStore('userInfo', {
	state: () => ({
		userId: '',
		state: 1,
		username: '',
		phone: '',
		avatarUrl: '/static/logo.png'
	}),
	getters: {

	},
	actions: {
		setUserInfo(id, state, name, phone,avater) {
			this.userId = id
			this.state = state
			this.username = name
			this.phone = phone
			this.avatarUrl = avater
		},
		clearUserInfo() {
		      this.userId = ''
		      this.state = 1
		      this.username = ''
		      this.phone = ''
		      this.avatarUrl = '/static/logo.png'
		    }
	},
	persist: {
		enabled: true,
	},
})